import {PageContainer} from "@ant-design/pro-layout";
import ProCard from "@ant-design/pro-card";
import type {ProTableProps} from "@ant-design/pro-table";
import ProTable from "@ant-design/pro-table";

import {Space} from "antd";
import  {useRef} from "react";
import type {ActionType} from "@ant-design/pro-table/lib/typing";


import type {OptionActions} from "@/type/type";

import {artifacts} from "@/services/system/harbor/api";
import {columns} from "@/pages/system/tool/harbor/artifact/config/columns";

export default () => {

  const actionRef = useRef<ActionType>();

  // @ts-ignore
  const optionAction: OptionActions<any, any> = {
    import: {
      maxCount: 1,
      showUploadList: false,
      beforeUpload: (file) => {
      }
    },
    edit(data) {

    },
    editModal: (data: any) => {
      return {}
    },
    add() {


    },
    addModal: {

    },
    export() {

    },
    remove(ids) {

    },
    exportTemplate() {

    }
  }

  // @ts-ignore
  const tableProps
    :
    ProTableProps<any, any> = {
    rowSelection: {
      // selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT],
      // selections: [],
    },
    tableAlertRender: false,
    tableAlertOptionRender: false,
    tableStyle: {},
    size: "small",
    bordered: true,
    // @ts-ignore
    columns: columns(optionAction),
    request: async (params, sort, filter) => {
      return await artifacts("cool-tea", "socializing").then(res => {
        return {
          data: res.data,
          success: true,
          // total: res.data.total
        }
      })
    },
    headerTitle: (
      <Space>

      </Space>
    ),
    actionRef,
    rowKey: "id"
  }
  return (
    <PageContainer>
      <ProCard>
        <ProTable<any, any> {...tableProps}>
        </ProTable>
      </ProCard>
    </PageContainer>
  )
}
